<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="JeapSik">
    <link rel="icon" href="img/favicon.ico" type="image/gif">
    <title>JeapSik-登录</title>
    <link rel="stylesheet" href="css/all.min.css">
    <style>
        :root {
            --primary-color: #667eea;
            --secondary-color: #764ba2;
            --light-color: #f8f9fa;
            --dark-color: #212529;
            --success-color: #48bb78;
            --error-color: #f56565;
            --warning-color: #ed8936;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background-size: cover;
            background-position: center;
            transition: background-image 0.5s ease;
        }
        
        .login-container {
            display: flex;
            width: 900px;
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
            border-radius: 15px;
            overflow: hidden;
        }
        
        .login-left {
            flex: 1;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 50px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            position: relative;
            overflow: hidden;
        }
        
        .login-left::before {
            content: '';
            position: absolute;
            width: 300px;
            height: 300px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 50%;
            top: -100px;
            right: -100px;
        }
        
        .login-left::after {
            content: '';
            position: absolute;
            width: 200px;
            height: 200px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 50%;
            bottom: -50px;
            right: -50px;
        }
        
        .welcome-text h1 {
            font-size: 2.5rem;
            margin-bottom: 15px;
            position: relative;
            z-index: 1;
        }
        
        .welcome-text p {
            font-size: 1rem;
            line-height: 1.6;
            opacity: 0.9;
            margin-bottom: 30px;
            position: relative;
            z-index: 1;
        }
        
        .features {
            margin-top: 30px;
            position: relative;
            z-index: 1;
        }
        
        .feature-item {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }
        
        .feature-icon {
            width: 40px;
            height: 40px;
            background: rgba(255, 255, 255, 0.2);
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            margin-right: 15px;
        }
        
        .login-right {
            flex: 1;
            background: #ffffff;
            padding: 50px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }
        
        .login-header {
            text-align: center;
            margin-bottom: 40px;
        }
        
        .login-header h2 {
            color: #764ba2;
            font-size: 2rem;
            margin-bottom: 10px;
        }
        
        .form-group {
            margin-bottom: 20px;
            position: relative;
        }
        
        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #764ba2;
            font-size: 1.2rem;
            font-weight: 500;
        }
        
        .form-control {
            width: 100%;
            padding: 12px 15px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 0.95rem;
            transition: all 0.3s;
            background-color: #f8f9fa;
        }
        
        .form-control:focus {
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
            outline: none;
            background-color: white;
        }
        
        .password-container {
            position: relative;
        }
        
        .toggle-password {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            cursor: pointer;
            color: #6c757d;
        }
        
        .login-btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            margin-bottom: 20px;
        }
        
        .login-btn:hover {
            background: linear-gradient(135deg, #5a6fd1 0%, #6a4293 100%);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        /* 美化后的模态框样式 */
        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(5px);
            transition: opacity 0.3s ease;
        }

        .modal-content {
            position: relative;
            background-color: white;
            margin: 10% auto;
            padding: 30px;
            border-radius: 12px;
            width: 350px;
            max-width: 90%;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            animation: modalFadeIn 0.3s ease;
            text-align: center;
        }

        @keyframes modalFadeIn {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .modal-icon {
            font-size: 48px;
            margin-bottom: 20px;
        }

        .success-icon {
            color: var(--success-color);
        }

        .error-icon {
            color: var(--error-color);
        }

        .warning-icon {
            color: var(--warning-color);
        }

        .modal-message {
            font-size: 16px;
            margin-bottom: 20px;
            color: var(--dark-color);
        }

        .modal-btn {
            padding: 10px 20px;
            border: none;
            border-radius: 6px;
            background-color: var(--primary-color);
            color: white;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .modal-btn:hover {
            background-color: #5a6fd1;
            transform: translateY(-2px);
        }

        /* 加载中等待框样式 */
        .loading-modal {
            display: none;
            position: fixed;
            z-index: 1001;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(5px);
        }

        .loading-modal-content {
            position: relative;
            background-color: white;
            margin: 15% auto;
            padding: 30px;
            border-radius: 12px;
            width: 200px;
            max-width: 90%;
            box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
            text-align: center;
        }

        .spinner {
            width: 50px;
            height: 50px;
            margin: 0 auto 20px;
            border: 4px solid rgba(0, 0, 0, 0.1);
            border-left-color: var(--primary-color);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to {
                transform: rotate(360deg);
            }
        }
        
        @media (max-width: 768px) {
            .login-container {
                flex-direction: column;
                width: 90%;
                height: auto;
            }
            
            .login-left, .login-right {
                padding: 30px;
            }
            
            .login-left {
                order: 2;
            }
            
            .welcome-text h1 {
                font-size: 2rem;
            }
        }

        /* 背景图片类 */
        .default-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-Default.png');
        }
        .new-year-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-NewYear.png');
        }
        .valentines-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-ValentinesDay.png');
        }
        .women-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-WomensDay.png');
        }
        .labor-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-LaborDay.png');
        }
        .youth-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-YouthDay.png');
        }
        .children-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-ChildrensDay.png');
        }
        .teachers-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-TeachersDay.png');
        }
        .national-day-bg {
            background-image: linear-gradient(rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0.1)), url('img/BG-NationalDay.png');
        }
    </style>
</head>
<body class="default-bg">
    <div class="login-container">
        <div class="login-left">
            <div class="welcome-text">
                <h1>全场景工具集</h1>
                <p id="holiday-text">全场景覆盖，登录账户，一键触达需求！</p>
            </div>
            <div class="features">
                <div class="feature-item">
                    <div class="feature-icon">
                        <i class="fas fa-shield-alt"></i>
                    </div>
                    <div>
                        <h4>安全可靠</h4>
                        <p>纯前端应用，数据本地化</p>
                    </div>
                </div>
                <div class="feature-item">
                    <div class="feature-icon">
                        <i class="fas fa-bolt"></i>
                    </div>
                    <div>
                        <h4>快速高效</h4>
                        <p>极速响应，提升您的工作效率</p>
                    </div>
                </div>
                <div class="feature-item">
                    <div class="feature-icon">
                        <i class="fas fa-cog"></i>
                    </div>
                    <div>
                        <h4>易于使用</h4>
                        <p>直观的界面设计，操作简单</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="login-right">
            <div class="login-header">
                <h2>登录JeapSik</h2>
            </div>
            <form>
                <div class="form-group">
                    <label for="username">账号</label>
                    <input type="text" id="username" class="form-control" placeholder="请输入账号" required>
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <div class="password-container">
                        <input type="password" id="password" class="form-control" placeholder="请输入密码" required>
                        <i class="fas fa-eye toggle-password" onclick="togglePassword()"></i>
                    </div>
                </div>
                <button type="button" class="login-btn" onclick="login()">登录</button>
            </form>
        </div>
    </div>
    
    <!-- 模态框 -->
    <div id="myModal" class="modal">
        <div class="modal-content">
            <div id="modal-icon" class="modal-icon error-icon">
                <i class="fas fa-exclamation-circle"></i>
            </div>
            <p id="modal-message" class="modal-message">用户名或密码错误</p>
            <button class="modal-btn" onclick="closeModal()">确定</button>
        </div>
    </div>
    
    <!-- 加载中等待框 -->
    <div id="loadingModal" class="loading-modal">
        <div class="loading-modal-content">
            <div class="spinner"></div>
            <p>登录成功！加载中...</p>
        </div>
    </div>
    
    <script src="js/crypto-js.min.js"></script>
    <script>
        // 每年固定的阳历节假日数据、提前两天显示节假日主题
        const holidays = [
            { name: "元旦", start: new Date(0, 0, -1), end: new Date(0, 0, 3), className: "new-year-bg", text: "新年快乐！愿您在新的一年里，工作顺利，阖家幸福！" },
            { name: "情人节", start: new Date(0, 1, 12), end: new Date(0, 1, 14), className: "valentines-day-bg", text: "情人节快乐！愿您与爱人相伴，幸福美满！" },
            { name: "妇女节", start: new Date(0, 2, 6), end: new Date(0, 2, 8), className: "women-day-bg", text: "妇女节快乐！向所有女性致敬，您们辛苦了！" },
            { name: "劳动节", start: new Date(0, 4, -1), end: new Date(0, 4, 5), className: "labor-day-bg", text: "劳动节快乐！劳动创造价值，向所有劳动者致敬！" },
            { name: "青年节", start: new Date(0, 4, 2), end: new Date(0, 4, 4), className: "youth-day-bg", text: "青年节快乐！青春无悔，奋斗不止！" },
            { name: "儿童节", start: new Date(0, 5, -1), end: new Date(0, 5, 1), className: "children-day-bg", text: "儿童节快乐！愿您保持童心，永远快乐！" },
            { name: "教师节", start: new Date(0, 8, 8), end: new Date(0, 8, 10), className: "teachers-day-bg", text: "教师节快乐！感谢老师的辛勤付出和教导！" },
            { name: "国庆节", start: new Date(0, 9, -1), end: new Date(0, 9, 7), className: "national-day-bg", text: "国庆节快乐！祝愿祖国繁荣昌盛，国泰民安！" },
        ];
        
        // 根据当前日期设置背景和欢迎语
        function setHolidayBackground() {
            const today = new Date();
            const currentMonth = today.getMonth();
            const currentDate = today.getDate();
            today.setHours(0, 0, 0, 0); // 设置时间为00:00:00，只比较日期
            
            const holidayElement = document.getElementById('holiday-text');
            const body = document.body;
            
            // 移除所有节日背景类
            body.classList.remove(
                "new-year-bg", "spring-festival-bg", "valentines-day-bg", "lantern-festival-bg", 
                "women-day-bg", "qingming-festival-bg", "labor-day-bg", "youth-day-bg", 
                "children-day-bg", "dragon-boat-bg", "teachers-day-bg", 
                "mid-autumn-bg", "national-day-bg"
            );
            
            // 默认背景和欢迎语
            let isHoliday = false;
            
            // 检查今天是否是节假日（不考虑年份，只比较月和日）
            for (const holiday of holidays) {
                // 创建今年的节日日期
                const holidayStartThisYear = new Date(today.getFullYear(), holiday.start.getMonth(), holiday.start.getDate());
                const holidayEndThisYear = new Date(today.getFullYear(), holiday.end.getMonth(), holiday.end.getDate());
                
                if (today >= holidayStartThisYear && today <= holidayEndThisYear) {
                    body.classList.add(holiday.className);
                    holidayElement.textContent = holiday.text;
                    isHoliday = true;
                    break;
                }
            }
            
            // 如果不是节假日，使用默认背景
            if (!isHoliday) {
                body.classList.add("default-bg");
                holidayElement.textContent = "全场景覆盖，登录账户，一键触达需求！";
            }
        }
        
        // 切换密码可见性
        function togglePassword() {
            const passwordInput = document.getElementById('password');
            const toggleIcon = document.querySelector('.toggle-password');
            
            if (passwordInput.type === 'password') {
                passwordInput.type = 'text';
                toggleIcon.classList.replace('fa-eye', 'fa-eye-slash');
            } else {
                passwordInput.type = 'password';
                toggleIcon.classList.replace('fa-eye-slash', 'fa-eye');
            }
        }
        
        function showModal(message, type = 'error') {
            const modal = document.getElementById('myModal');
            const modalIcon = document.getElementById('modal-icon');
            const modalMessage = document.getElementById('modal-message');
            
            // 设置图标和颜色
            modalIcon.className = 'modal-icon';
            modalIcon.innerHTML = '';
            
            if (type === 'error') {
                modalIcon.classList.add('error-icon');
                modalIcon.innerHTML = '<i class="fas fa-exclamation-circle"></i>';
            } else if (type === 'warning') {
                modalIcon.classList.add('warning-icon');
                modalIcon.innerHTML = '<i class="fas fa-exclamation-triangle"></i>';
            } else if (type === 'success') {
                modalIcon.classList.add('success-icon');
                modalIcon.innerHTML = '<i class="fas fa-check-circle"></i>';
            }
            
            modalMessage.textContent = message;
            modal.style.display = 'block';
        }
        
        function closeModal() {
            document.getElementById('myModal').style.display = 'none';
        }
        
        function login() {
            const username = document.getElementById('username').value.trim();
            const password = document.getElementById('password').value.trim();
            
            // 验证用户名和密码是否为空
            if (!username) {
                showModal('请输入用户名', 'warning');
                document.getElementById('username').focus();
                return;
            }
            
            if (!password) {
                showModal('请输入密码', 'warning');
                document.getElementById('password').focus();
                return;
            }
            
            const usernameMd5 = CryptoJS.MD5(username).toString();
            const passwordMd5 = CryptoJS.MD5(password).toString();
            
            const correctUsername = '32981a13284db7a021131df49e6cd203';
            const correctPassword = '91ac9cbd813936f08de5abb74c8e010e';
            const loadingModal = document.getElementById('loadingModal');
            
            if (usernameMd5 === correctUsername && passwordMd5 === correctPassword) {
                localStorage.setItem('jsUserName', username);
                localStorage.setItem('usernameMd5', usernameMd5);
                localStorage.setItem('passwordMd5', passwordMd5);
                localStorage.setItem('loginTime', new Date());
                loadingModal.style.display = 'block';
                setTimeout(() => {
                    window.location.href = 'index.html';
                }, 1000);
            } else {
                showModal('用户名或密码错误', 'error');
            }
        }
        
        // 点击模态框外部关闭
        window.onclick = function(event) {
            const modal = document.getElementById('myModal');
            if (event.target == modal) {
                closeModal();
            }
        }
        
        // 回车键登录
        document.addEventListener('keydown', function(event) {
            if (event.key === 'Enter') {
                login();
            }
        });
        
        // 页面加载时设置背景
        document.addEventListener('DOMContentLoaded', setHolidayBackground);
    </script>
</body>
</html>    